﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace RunUI.Attributes
{
    public interface IAsyncModelPropertyValidator
    {
        Task<bool> ValidateAsync(object model, PropertyInfo property, out string errorMessage);
    }
    public interface IModelPropertyValidator
    {
        bool Validate(object model, PropertyInfo property, out string errorMessage);
    }
    public interface IAsyncModelValidator
    {
        Task<bool> ValidateAsync(object model, out PropertyInfo property, out string errorMessage);
    }
    public interface IModelValidator
    {
        bool Validate(object model, out PropertyInfo property, out string errorMessage);
    }

    public abstract class AbstractAsyncModelPropertyValidatorAttribute : Attribute, IAsyncModelPropertyValidator
    {
        public abstract Task<bool> ValidateAsync(object model, PropertyInfo property, out string errorMessage);
    }

    public abstract class AbstractModelPropertyValidatorAttribute : Attribute, IModelPropertyValidator
    {
        public abstract bool Validate(object model, PropertyInfo property, out string errorMessage);
    }

    public abstract class AbstractAsyncModelValidatorAttribute : Attribute, IAsyncModelValidator
    {
        public abstract Task<bool> ValidateAsync(object model, out PropertyInfo property, out string errorMessage);
    }

    public abstract class AbstractModelValidatorAttribute : Attribute, IModelValidator
    {
        public abstract bool Validate(object model, out PropertyInfo property, out string errorMessage);
    }
}
